//
//  EADrinkingViewController.m
//  WhatToEat
//
//  Created by 方力 on 15/10/27.
//  Copyright © 2015年 Mac. All rights reserved.
//

#import "EADrinkingViewController.h"

@interface EADrinkingViewController ()

@end

@implementation EADrinkingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title=@"饮水记录";
    
    
    
    
    UIView * bgView=[[UIView alloc] init];
    
    [self.view addSubview:bgView];
    bgView.layer.borderColor=kLightGrayColor.CGColor;
    bgView.layer.borderWidth=1;
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        //        make.size.mas_equalTo(CGSizeMake(200, 44));
        make.size.mas_equalTo(CGSizeMake(220, 34));
        
        make.centerX.mas_equalTo(self.view);
        make.top.mas_equalTo(self.view).with.offset(48);
        
    }];
    
    
    
    
    UITextField * tf=[[UITextField alloc] init];
    
    
    
    tf.placeholder=@"请输入今天的饮水量";
    

 //[tf setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];

   [tf setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];
    tf.keyboardType=UIKeyboardTypeNumberPad;
    self.tf=tf;
    [bgView addSubview:tf];
    
    
    [tf mas_makeConstraints:^(MASConstraintMaker *make) {
        

         make.size.mas_equalTo(CGSizeMake(150, 28));
        
        make.centerX .mas_equalTo(bgView);
     
        make.centerY.mas_equalTo(bgView).with.offset(2);
        
    }];

    
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ok"] style:0 target:self action:@selector(okAction)];
    
    
    UIImageView * shujvImageView=[[UIImageView alloc] init];
    
    [bgView addSubview:shujvImageView];
    shujvImageView.image=[UIImage imageNamed:@"shuju"];
    [shujvImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.mas_equalTo(bgView);
        
        make.leadingMargin.mas_equalTo(bgView).with.offset(10);
        
        
    }];
    
    
    
    UIView * line=[[UIView alloc] init];
    line.backgroundColor=[UIColor colorWithRed:197/225.0 green:197/225.0 blue:197/225.0 alpha:1];
    [self.view addSubview:line];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(bgView.mas_bottom).with.offset(34);
        make.centerX.mas_equalTo(self.view);
        make.size.mas_equalTo(CGSizeMake(kUI_SCREEN_WIDTH-44, 1));
        
        
        
    }];
    
    
    
    
    UIImageView * imageView=[[UIImageView alloc] init];
    
    imageView.image=[UIImage imageNamed:@"可参考以下数据："];
    
    
    [self.view addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self.view);
        
        make.top.mas_equalTo(line.mas_bottom).with.offset(25);
        
        
        
        
    }];
    
    
    
    
}


-(void)okAction
{

    
    if (self.tf.text.length==0) {
        
        
        [SVProgressHUD showImage:nil status:@"请输入饮水量"];
        
        
        return;
    }
    
    
    
    
    
    [self.navigationController popViewControllerAnimated:YES];

}

@end
